﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" >
<head>
  <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
  <link rel="stylesheet" href="../css/uftestsuite.css" type="text/css" />
  <script type="text/javascript" src="iso-date.js"></script>
  <title>Microformats date and time formats</title>
  <script type="text/javascript">
  	function checkDates( id) {
  		elt = document.getElementById(id);
  		iso = new ISODate( elt.value );
  		//iso.Parse( elt.value );
  		//iso.format ='standard';
  		alert( iso.toString() );
  	}
  	
  	function compareDates( id1, id2 ) {
  		elt1 = document.getElementById(id1);
  		elt2 = document.getElementById(id2);
  		output = new ISODate( elt1.value ).toString() + ' - ' + new ISODate( elt2.value ).toString();
  		alert( 'Are equal: ' + CompareISODates( elt1.value, elt2.value ) + '\n' + output );
  	}

  
  </script>
</head>
<body class="documentation">

    <p>
    <a href="http://www.ufxtract.com/testsuite/"><img border="0" id="testsuite-image" alt="Microformats testsuite" src="../images/testsuite.gif" /></a><br />
    </p>
    
    <h1>Microformats duration formats</h1>
    
    <h2>Introduction</h2>
    <p>
    Although microformats use two subsets of 
	<a href="http://en.wikipedia.org/wiki/ISO_8601">ISO 8601</a> standard to describe dates and times, 
	duration are taken directly from ISO standard.&nbsp; There are in fact two 
	way different ways to represent a duration in ISO 8601. Both start with the 
	letter P which stands for period. The most common of the two representations 
	is a combination of numbers followed by letters. So P10D stands for 10 days. 
	The second is a variation on the date and time format P0001-02-10 stands for 
	1year, 2 months and 10 days. Both these representations can be used as microformat 
	duration.&nbsp;&nbsp;   
    </p>
    
   
   
   	<h2>Representation 1</h2>
   	<p>Summary of rules to create a duration</p>
	<ul>
		<li>The capital letters &#39;P&#39;, &#39;Y&#39;, &#39;M&#39;, &#39;W&#39;, &#39;D&#39;, &#39;T&#39;, &#39;H&#39;, &#39;M&#39;, and &#39;S&#39; 
		are designators for each of the date and time elements<ul>
			<li>P is the duration designator (historically called &quot;period&quot;) 
			placed at the start of the duration representation.</li>
			<li>Y - number of years.</li>
			<li>M - number of months.</li>
			<li>W - number of weeks.</li>
			<li>D - number of days.</li>
			<li>T is the time designator that comes before the time.</li>
			<li>H - number of hours.</li>
			<li>M - number of minutes.</li>
			<li>S - number of seconds.</li>
		</ul>
		</li>
		<li>MUST use T punctuation to mark the beginning of the time segment</li>
		<li>CAN use decimal fraction on the smallest value </li>
		<li>The designator MUST be uppercased</li>
		<li>Date and time values CAN exceed their &quot;carry-over points&quot; i.e. P45H is 45 hour</li>
	</ul>
    
   
	<h2>Representation 1 format examples</h2>

<pre>
ISO 8601 duration format - representation 1 - valid structures 
P9MP1Y2M
P1Y2M10D
P1Y2M10DT20H
P1Y2M10DT20H30M
P1Y2M10DT20H30M30S
P1Y2M10DT20H30M30.5S
P1Y2M10DT20.5H
P110D
PT30M</pre>
    
   
   	<h2>Representation 2</h2>
   	<p>Summary of rules to create a duration</p>
   	<ul>
		<li>MUST start with the letter P</li>
		<li>MUST use a full 4 digit for year</li>
		<li>MUST use a full 2 digit for month, days, hours, min and sec</li>
		<li>MUST use T punctuation to mark the beginning of the time segment</li>
		<li>MUST use dash &quot;-&quot; for date punctuation</li>
		<li>MUST use colon &quot;:&quot; for time punctuation</li>
		<li>Date and time values CAN NOT exceed their &quot;carry-over points&quot; i.e. 
		P0001-13 is wrong you can only have 11 months</li>
	</ul>
	
	<h2>Representation 2 format examples</h2>

<pre>
ISO 8601 duration format - representation 2 - valid structures 
P0001-02-10
P0001-02-10T14:30:30
</pre>
<br />

	<a rel="license" href="license.txt">Some rights reserved</a>
    
    
</body>
</html>
